# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=jast
pkgver=17.361ecde
pkgrel=8
pkgdesc='Just Another Screenshot Tool.'
arch=('any')
url='https://github.com/mikehacksthings/jast'
license=('custom::unknown')
groups=('blackarch'  'blackarch-webapp'  'blackarch-recon'  'blackarch-misc')
depends=('python' 'python-selenium' 'python-requests' 'python-docopt'
         'python-urllib3')
makedepends=('git')
provides=('jast')
source=("git+https://github.com/mikehacksthings/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"

  install -Dm 755 -t "$pkgdir/usr/share/$pkgname" *.py
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" README.md

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python3 $pkgname.py "\$@"
EOF
  chmod +x "$pkgdir/usr/bin/$pkgname"
}

